package com.timesheet.gui.tasktracker.viewmodel;

import java.util.ArrayList;
import java.util.List;

public class TaskTrackerViewModelContainer extends ViewModel {

	private List<TaskTrackerViewModel> list = new ArrayList<TaskTrackerViewModel>();

	private TaskTrackerViewModel dto;

	private static TaskTrackerViewModelContainer modelContainer;

	private TaskTrackerViewModelContainer() {

	}

	public static TaskTrackerViewModelContainer getInstance() {
		if (modelContainer == null) {
			modelContainer = new TaskTrackerViewModelContainer();
		}
		return modelContainer;

	}

	public void setList(List<TaskTrackerViewModel> list) {
		firePropertyChange("list", this.list, list);
		this.list = list;

	}

	public List<TaskTrackerViewModel> getList() {
		return list;
	}

	public void setDto(TaskTrackerViewModel dto) {
		firePropertyChange("dto", this.dto, dto);
		this.dto = dto;
	}

	public TaskTrackerViewModel getDto() {
		return dto;
	}

	public void add(TaskTrackerViewModel dto) {
		list.add(dto);
		firePropertyChange("dto", this.dto, dto);
		//list.add(dto);

	}

	public List<TaskTrackerViewModel> createTaskTrackerDtos() {

		//List<TaskTrackerViewModel> listDto = new ArrayList<TaskTrackerViewModel>();
		TaskTrackerViewModel dto1 = new TaskTrackerViewModel();
		dto1.setActualEffort(null);
		dto1.setPlannedEffort(null);
		dto1.setTaskNo("108");
		dto1.setTaskStatus("OPEN");
		dto1.setTaskType("Demand");

		list.add(dto1);

		return list;

	}

}
